perm filename LISP.PAS[LSP,JRA] blob sn#421858 filedate 1979-02-24 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	program pascalsucks(output)
C00004 ENDMK
C⊗;
program pascalsucks(output);


type 
     string = packed array[1..16] of char;

     dtypes = (lit, num, dtpr);

     sexpr = ↑ s1;

     s1 = record
		case dt: dtypes of
		 lit:  (pname : string);
		 num:  (value: integer);
		 dtpr: (car: sexpr;
		       cdr: sexpr);

end;

var foo,bar, fubar : sexpr;

function cons (x,y : sexpr) : sexpr;
	    var z : sexpr;
         begin
	     new (z,dtpr);
	     z↑.car := x;
	     z↑.cdr := y;
    	     cons := z
         end;


function null (x : sexpr) : boolean;
      begin
	null := (x↑.pname = 'NIL4567890123456')
	 end;

function append (x, y : sexpr) : sexpr;
 begin
  if null(x) then append := y 
      else 
	append := cons (x↑.car,
			append (x↑.cdr,y)) 
end;

new(foo, num);
new(bar, num);

foo↑value := 1;
bar↑value := 2;


fubar := cons(foo,bar);

 end .